package com.ruoyi.appreciate.teacomposition.service.impl;

import java.util.List;

import com.ruoyi.appreciate.teacomposition.domain.TeacherComposition;
import com.ruoyi.appreciate.teacomposition.service.ITeacherCompositionService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.appreciate.mapper.TeacherCompositionMapper;

/**
 * 教师作品Service业务层处理
 * 
 * @author duanxinli
 * @date 2025-09-15
 */
@Service
public class TeacherCompositionServiceImpl implements ITeacherCompositionService
{
    @Autowired
    private TeacherCompositionMapper teacherCompositionMapper;

    /**
     * 查询教师作品
     * 
     * @param id 教师作品主键
     * @return 教师作品
     */
    @Override
    public TeacherComposition selectTeacherCompositionById(String id)
    {
        return teacherCompositionMapper.selectTeacherCompositionById(id);
    }

    /**
     * 查询教师作品列表
     * 
     * @param teacherComposition 教师作品
     * @return 教师作品
     */
    @Override
    public List<TeacherComposition> selectTeacherCompositionList(TeacherComposition teacherComposition)
    {
        return teacherCompositionMapper.selectTeacherCompositionList(teacherComposition);
    }

    /**
     * 新增教师作品
     * 
     * @param teacherComposition 教师作品
     * @return 结果
     */
    @Override
    public int insertTeacherComposition(TeacherComposition teacherComposition)

    {
        teacherComposition.setId(IdUtils.fastUUID());
        teacherComposition.setCreateDate(DateUtils.getNowDate());
        String username = SecurityUtils.getUsername();
        teacherComposition.setCreateBy(username);
        teacherComposition.setSort(0L);
        teacherComposition.setDelFlag(0L);
        return teacherCompositionMapper.insertTeacherComposition(teacherComposition);
    }

    /**
     * 修改教师作品
     * 
     * @param teacherComposition 教师作品
     * @return 结果
     */
    @Override
    public int updateTeacherComposition(TeacherComposition teacherComposition)
    {
        return teacherCompositionMapper.updateTeacherComposition(teacherComposition);
    }

    /**
     * 批量删除教师作品
     * 
     * @param ids 需要删除的教师作品主键
     * @return 结果
     */
    @Override
    public int deleteTeacherCompositionByIds(String[] ids)
    {
        return teacherCompositionMapper.deleteTeacherCompositionByIds(ids);
    }

    /**
     * 删除教师作品信息
     * 
     * @param id 教师作品主键
     * @return 结果
     */
    @Override
    public int deleteTeacherCompositionById(String id)
    {
        return teacherCompositionMapper.deleteTeacherCompositionById(id);
    }
}
